package com.yunji.base.service;

import com.yunji.base.dao.IAgentSiteDao;
import com.yunji.base.domain.AgentSiteDO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.user.service.impl
 * @FileName AgentSiteServiceImpl.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-05-28 18:06:50
 * @Description 代理商网点接口实现
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo0803@163.com	2024-05-28 18:06:50		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
@Component
public class AgentSiteService {
    @Resource
    IAgentSiteDao agentSiteDao;

    public List<AgentSiteDO> search(AgentSiteDO agentSite) {
        return agentSiteDao.search(agentSite);
    }

    /**
     * @param agentSite 代理网点绑定关系
     * @Title create
     * @Desc 创建代理网点绑定关系
     * @Date 2024-05-29 15:24:32.688
     * @Return boolean 创建结果
     */

    public boolean create(AgentSiteDO agentSite) {
        return agentSiteDao.save(agentSite);
    }

    /**
     * @param ids 代理网点关系ID
     * @Title delete
     * @Desc 删除代理网点绑定关系
     * @Date 2024-05-29 15:25:21.451
     * @Return boolean 删除结果
     */

    public boolean delete(Long... ids) {
        return agentSiteDao.removeBatchByIds(Arrays.asList(ids));
    }

    /**
     * @param siteId 网点ID
     * @Title selectBySiteId
     * @Desc 根据网点ID获取代理商网点绑定关系
     * @Date 2024-06-04 14:12:46.748
     * @Return List<AgentSite> 代理商网点绑定关系
     */

    public List<AgentSiteDO> selectBySiteId(Long... siteId) {
        return agentSiteDao.listBySiteIds(Arrays.asList(siteId));
    }

    public boolean deleteBySiteIds(Long... ids) {
        return agentSiteDao.deleteBySiteIds(ids);
    }
}